import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { EpisodesVO, EpisodesForm, EpisodesQuery } from '@/api/content/episodes/types';

/**
 * 查询剧集管理列表
 * @param query
 * @returns {*}
 */

export const listEpisodes = (query?: EpisodesQuery): AxiosPromise<EpisodesVO[]> => {
  return request({
    url: '/content/episodes/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询剧集管理详细
 * @param episodeId
 */
export const getEpisodes = (episodeId: string | number): AxiosPromise<EpisodesVO> => {
  return request({
    url: '/content/episodes/' + episodeId,
    method: 'get'
  });
};

/**
 * 新增剧集管理
 * @param data
 */
export const addEpisodes = (data: EpisodesForm) => {
  return request({
    url: '/content/episodes',
    method: 'post',
    data: data
  });
};

/**
 * 修改剧集管理
 * @param data
 */
export const updateEpisodes = (data: EpisodesForm) => {
  return request({
    url: '/content/episodes',
    method: 'put',
    data: data
  });
};

/**
 * 删除剧集管理
 * @param episodeId
 */
export const delEpisodes = (episodeId: string | number | Array<string | number>) => {
  return request({
    url: '/content/episodes/' + episodeId,
    method: 'delete'
  });
};
